/*************************************************************************
 * @file: vertex.h
 * @date: 01/04/2012
 * TOPOL v1_0 - (c)copyright 2012 TEC/UFF
 *************************************************************************
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 ************************************************************************/

#ifndef _VERTEX
#define _VERTEX

// includes
//----------

// forward declarations
//----------------------
class IPoint;
class HalfEdge;
class Solid;


/*!
 * CLASS
 * Vertex
 * 
 * This class implements the requirement for the topological entity named
 * Vertex and sets all the necessary adjacency informations
 * 
 * @author Andre Pereira (andremaues@id.uff.br)
 * @version 1.0.0
 * @see HalfEdge
 * @see Point
 * @see Solid
 */
class Vertex
{

public:

  ////////////////////////////////////////////////
  ///  Constructor and Destructor Declaration  ///
  ////////////////////////////////////////////////

  /**
   * @brief Constructs a vertex
   */
  Vertex();

  /**
   * @brief Constructs a vertex and attaches it into a given Solid object
   * @param _point consists of the geometric information of the vertex
   * @param _s is a solid object
   */
	Vertex( IPoint* _point, Solid* _s );

  /**
   * @brief Destructs the Vertex object
   */
  ~Vertex();

  ////////////////////////////////////
  ///  PUBLIC Methods Declaration  ///
  ////////////////////////////////////

  /**
   * @brief Gets the vertex identity
   * @return size_t with the vertex identity
   */
  size_t getVertexno(); 

  /**
   * @brief Gets the previous vertex
   * @return Vertex* pointer to the previous vertex object
   */
  Vertex* getPrevVertex();

  /**
   * @brief Gets the next vertex
   * @return Vertex* pointer to the next vertex object
   */
  Vertex* getNextVertex();

  /**
   * @brief Gets a half-edge that starts from this vertex
   * @return HalfEdge* pointer to the half-edge that starts from this vertex
   */
  HalfEdge* getVEdge();

  /**
   * @brief Gets the coordinates of the geometric point associated with this vertex
   * @return Point* pointer to the object which contains the coordinates
   */
  IPoint* getPoint();

  /**
   * @brief Verifies if the vertex is selected or not
   * @return bool with selection status (true: selected, false: not selected)
   */
  bool isSelected();

  /**
   * @brief Sets an identity for the vertex
   * @param _v the vertex identity
   */
  void setVertexno( size_t _v );

  /**
   * @brief Sets a half-edge that starts from this vertex
   * @param _hed is the half-edge that starts from this vertex
   */
  void setVedge( HalfEdge* _hed );

  /**
   * @brief Sets if the vertex is selected or not
   * @param _select is used to define the selection status (true: selected, false: not selected)
   */
  void setSelection( bool _select );


private:

  ////////////////////////////////
  ///  Attributes Declaration  ///
  ////////////////////////////////

  /** @brief Identification of the vertex, i.e., the vertex identity */
	size_t m_vertexno;

  /** @brief Pointer to the previous vertex */
	Vertex* m_prevv;

  /** @brief Pointer to the next vertex */
	Vertex* m_nextv;

  /** @brief Pointer to one half-edge */
	HalfEdge* m_vedge;

  /** @brief Pointer to the geometric point */
	IPoint* m_coord;

  /** @brief Flag to identify if the vertex is selected or not */
  bool m_isSelected;		

};

#endif
